package com.amado.course10Function;

import java.util.Scanner;

public class Function01Hello2 {
	public static void main(String[] args) {
		while(true) {
			System.out.println("1、登陆 2、退出");
			Scanner scanner = new Scanner(System.in);
			int menuSelect = scanner.nextInt();
			if(menuSelect==1) {
//				System.out.println("请输入用户名");
//				String userName = scanner.next();
//				System.out.println("请输入密码");
//				String password = scanner.next();
//				if("admin".equals(userName)&& "admin".equals(password)){
//					System.out.println("登陆成功"));
//				}
				if(login()) {
					System.out.println("登陆成功");
				}else {
					System.out.println("登陆失败");
				}
			}
		}
	}
	
	/**
	 *  登陆
	 * @return 成功返回true,失败返回false
	 */
	public static boolean login() {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入用户名");
		String userName = scanner.next();
		System.out.println("请输入密码");
		String password = scanner.next();
		if("admin".equals(userName)&& "admin".equals(password)){
			return true;
		}
		return false;
	}
}
